<?php
/**
 * Created by PhpStorm.
 * User: jungshen
 * Date: 2019/3/12
 * Time: 17:41
 */

namespace app\api2\Service;


use think\Db;

class InquiryService
{
    /**
     * 根据用户类型获取各自的昵称
     * @param $nickname 默认昵称
     * @param $member_type 用户类型
     * @param $mid 用户ID
     * @return mixed
     */
    static function deal_nickname($nickname,$member_type,$mid){
        switch ($member_type){
            case 0:
                return $nickname;
            case 1:
                return Db::name('worker_info')
                    ->where('mid',$mid)
                    ->value('name');
            case 2:
                return Db::name('supplier_info')
                    ->where('mid',$mid)
                    ->value('name');
        }
    }
}